﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HotelManager.DataAccess;
using HotelManager.DataAccess.Model;

namespace HotelManager.WebUI.Binders
{
    public class SearchInfoBinder : IModelBinder
    {
        private const string sessionKey = "info";

        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            // Get info from session
            SearchInfoModel model = (SearchInfoModel) controllerContext.HttpContext.Session[sessionKey];

            // Return the list
            return model;
        }
    }
}